package hs.framework.opcClient.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

@Data
@TableName("th_opc_server")
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "OPCServer对象", description = "数据源信息表,用于对接控制数据")
@JsonIgnoreProperties({ "isDeleted" })
public class OPCServer extends BaseEntity{
    /**
     * 主键
     */
    @ApiModelProperty(value = "主键")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;
    /**
     * ip地址
     */
    @ApiModelProperty(value = "ip地址")
    @JsonSerialize(using = NullSerializer.class)
    private String host;
    /**
     * 域名
     */
    @ApiModelProperty(value = "域名")
    @JsonSerialize(using = NullSerializer.class)
    //（有没有无所谓，反正不会用）
    private String domain;
    /**
     * 用户名
     */
    @ApiModelProperty(value = "用户名（windows在DCOM配置权限的用户名）")
    @JsonSerialize(using = NullSerializer.class)
    private String user;
    /**
     * 密码
     */
    @ApiModelProperty(value = "密码")
    @JsonSerialize(using = NullSerializer.class)
    private String password;
    /**
     * 服务器id
     */
    @ApiModelProperty(value = "服务器id，用于寻找clsId")
    @JsonSerialize(using = NullSerializer.class)
    private String progId;
    /**
     * clsId
     */
    @ApiModelProperty(value = "clsId，opc服务器的唯一标识")
    @JsonSerialize(using = NullSerializer.class)
    private String clsId;
    /**
     * 最大连接时长
     */
    @ApiModelProperty(value = "最大连接时长")
    @JsonSerialize(using = NullSerializer.class)
    private String timeout;
    /**
     * 心跳间隔
     */
    @ApiModelProperty(value = "心跳间隔")
    @JsonSerialize(using = NullSerializer.class)
    private String heartbeat;

    public String getKeyWord(){
        return getHost()+":"+getClsId();
    }
}
